Skip to content

fix(scroll): hide when scroll-to-top is clicked (@AzureNightlock)#7999

Open
AzureNightlock wants to merge 2 commits into
monkeytypegame:masterfrom
AzureNightlock:fix/scroll-to-top-visibility
Open

fix(scroll): hide when scroll-to-top is clicked (@AzureNightlock)#7999
AzureNightlock wants to merge 2 commits into
monkeytypegame:masterfrom
AzureNightlock:fix/scroll-to-top-visibility

Conversation

@AzureNightlock
Copy link
Copy Markdown
Contributor

@AzureNightlock AzureNightlock commented May 22, 2026

Description

This PR: Fixes the scroll to top button so that when clicked it is hidden

Changes Made:

  • Added a scrolling signal to save the scrolling state
  • Added a function that handles the scrolling state and scrolls the user up

Checks

  • Check if any open issues are related to this PR; if so, be sure to tag them below.
  • Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info)
  • Make sure to include your GitHub username prefixed with @ inside parentheses at the end of the PR title.

Closes #7967

@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label May 22, 2026
@Miodec Miodec requested a review from Copilot June 2, 2026 19:22
@github-actions github-actions Bot added the waiting for review Pull requests that require a review before continuing label Jun 2, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes ScrollToTop button state handling so it hides while scrolling-to-top is in progress (to avoid re-showing mid-scroll).

Changes:

  • Add scrolling signal to gate handleScroll updates during programmatic scroll-to-top
  • Introduce scrollUp() helper and await completion before restoring normal scroll handling

Comment on lines +17 to +24
const scrollUp = async (): Promise<void> => {
const scrollEnded = new Promise<void>((resolve) => {
if (window.scrollY === 0) return resolve();
window.addEventListener("scrollend", () => resolve(), { once: true });
});
window.scrollTo({ top: 0, behavior: "smooth" });
await scrollEnded;
};
Comment on lines +48 to +52
onClick={async () => {
setVisible(false);
window.scrollTo({
top: 0,
behavior: "smooth",
});
setScrolling(true);
await scrollUp();
setScrolling(false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff waiting for review Pull requests that require a review before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ScrollToTop button hold stops smooth scroll in Firefox

3 participants